<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 城市商圈
 * author : wucan
 * date : 2017-10-30
 */
class CityBusiness extends Model
{

    public $timestamps = false;

    protected $table = 'city_business';

    protected $fillable = [
        'id',
        'cityID',
        'name',
        'scope',
        'icon',
        'lng',
        'lat',
        'is_hot',
        'admin_id',
        'orderby',
        'icon_oss',
    ];

    protected $casts = ['icon'];

    public function getIconAttribute($value)
    {
        return \App\Library\HandleFile::handleFilePath($value, $this->icon_oss);
    }

    public function city()
    {
        return $this->hasOne('App\\Models\\City', 'cityID', 'cityID');
    }
}
